//
//  UIButton+XZButton.m
//  BabyHouseKeeper
//
//  Created by charles.huang on 16/8/19.
//  Copyright © 2016年 Jeff. All rights reserved.
//

#import "UIButton+XZButton.h"

@implementation UIButton (XZButton)

+(UIButton*)initButton:(CGRect)rect Image:(NSString *)image
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Image:(NSString *)image Title:(NSString *)title
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setTitle:title forState:UIControlStateNormal];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Image:(NSString *)image HighImage:(NSString *)highImage
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Image:(NSString *)image SelImage:(NSString *)selImage
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:selImage] forState:UIControlStateSelected];
    
    return button;
}

+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    return button;
}
+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor BackgorundColor:(UIColor *)backgroundColor
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setBackgroundColor:backgroundColor];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor SelTitleColor:(UIColor *)selTitleColor
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setTitleColor:selTitleColor forState:UIControlStateSelected];
    
    return button;
}
+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor Image:(NSString *)image
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    return button;
}


+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor BackgorundImage:(NSString *)bgImage
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:bgImage] forState:UIControlStateNormal];
    return button;
}

+(UIButton*)initButton:(CGRect)rect Title:(NSString *)title TitleColor:(UIColor *)titleColor BackgorundImage:(NSString *)bgImage SelBackgoroundImage:(NSString *)selBgImage
{
    UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:rect];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:titleColor forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:bgImage] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:selBgImage] forState:UIControlStateSelected];
    
    return button;
}

@end
